#include "head.h"

int WINAPI WinMain(
	HINSTANCE hInstance,
	HINSTANCE hPrevInstance,
	LPSTR lpCmdLine,
	int nCmdShow
)
{
	hPrevInstance;
	lpCmdLine;
	nCmdShow;
	static MSG msg;
	if (!RegClass(hInstance, L"MainClass", nullptr, MainWindowProc))return -1;
	HWND hWnd = CreateWindow(L"MainClass", L"MainWindow", WS_OVERLAPPEDWINDOW, 0, 0, 800, 600, nullptr, nullptr, hInstance, nullptr);
	if (!hWnd)return -1;
	ShowWindow(hWnd, SW_SHOW);
	InitD3D(hWnd);
	UpdateWindow(hWnd);
	while (1)
	{
		PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE);
		if (msg.message == WM_QUIT)return 0;
		TranslateMessage(&msg);
		DispatchMessage(&msg);
		RenderFrame();
	}
	ClearD3D();
	return msg.wParam;
}